package router

import (
	restfulspec "github.com/emicklei/go-restful-openapi/v2"
	"github.com/emicklei/go-restful/v3"
	"webGoDemo/controllers"
	"webGoDemo/model"
)

func AddRecordRouter(container *restful.Container) {
	ws := new(restful.WebService)
	ws.
		Path("/record").
		Consumes(restful.MIME_XML, restful.MIME_JSON).
		Produces(restful.MIME_JSON, restful.MIME_XML) // you can specify this presenter route as well
	tags := []string{"record"}
	ws.Route(ws.GET("/").To(controllers.List).
		// docs
		Doc("get all records").
		Metadata(restfulspec.KeyOpenAPITags, tags).
		Writes([]model.User{}).
		Returns(200, "OK", []model.Record{}))
	container.Add(ws)
}